package com.livepan.server.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class CalendarUtil {
    public static String calendarToString(Calendar calendar) {
        if (calendar == null) {
            return null;
        }
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置你想要的格式
        String dateStr = df.format(calendar.getTime());
        return dateStr;
    }

    public static String getCurrentTimeCode() {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// 设置你想要的格式
        String dateStr = df.format(calendar.getTime());
        return dateStr;
    }

}
